package com.sandasai.action.teacher;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sandasai.service.TeacherManager;
import com.sandasai.vo.WorkInfoForMark;
@Controller
@Scope("prototype")
public class MarkAction extends ActionSupport {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    @Resource
	private TeacherManager teacherManager;
    /**
     * @return
     */
    private Integer markId;
    private Double score;
    private String workType;
    public Integer getMarkId() {
		return markId;
	}

	public void setMarkId(Integer markId) {
		this.markId = markId;
	}

	public Double getScore() {
		return score;
	}

	public void setScore(Double score) {
		this.score = score;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	private String comment;
    private String tips;
    
    public String execute() throws Exception{
        ActionContext ctx = ActionContext.getContext();
        String username = (String) ctx.getSession().get("username");
        if(teacherManager.mark(username, this.markId, this.score, this.comment)) {
        	this.tips = "success!";
        	return SUCCESS;
        }else {
        	this.tips = "error!";
        	return ERROR;
        }
    }

	public String getTips() {
		return tips;
	}

	public void setTips(String tips) {
		this.tips = tips;
	}

	public String getWorkType() {
		return workType;
	}

	public void setWorkType(String workType) {
		this.workType = workType;
	}
}